package com.google.code.stalkernet.server.event;

import java.net.SocketAddress;
import java.util.EventObject;

/**
 * Encapsulates details of server-related event.
 *
 * @author Mikhail Vladimirov
 */
public class ServerEvent extends EventObject
{
    private final SocketAddress socketAddress;

    /**
     * Create new server event with given source and socket address.
     *
     * @param source event source
     * @param socketAddress socket address
     */
    public ServerEvent (Object source, SocketAddress socketAddress)
    {
        super (source);

        if (socketAddress == null)
            throw new IllegalArgumentException ("Socket address is null");

        this.socketAddress = socketAddress;
    }

    /**
     * Get socket address.
     *
     * @return socket address
     */
    public SocketAddress getSocketAddress ()
    {
        return socketAddress;
    }
}
